<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 一个棋盘有64个格子，第一格放1粒芝麻，第二格放2粒，第三格放4粒，以此类推，问放满棋盘需要多少粒芝麻
        var table=64;
        var i=1;
        var sum=0;
        while (table>1) {
            i=2*i;
            sum=sum+i;
            table--;
        }
        console.log('放满棋盘需要'+sum+'粒芝麻');
    </script>
</body>
</html>